package com.github.catvod.spider.merge;

import com.github.catvod.spider.merge.B;
import java.io.Reader;
import java.util.ArrayList;
import javax.annotation.ParametersAreNonnullByDefault;

/* loaded from: classes.dex */
abstract class vt {
    protected B BQ;
    protected ArrayList<Lm> I;
    UF V0;
    protected Qg W;
    protected F h;
    fd j;
    protected String oC;
    protected HZ q;
    private B.x u = new B.x();
    private B.qM Qy = new B.qM();

    vt() {
    }

    protected boolean BQ(String str) {
        B b = this.BQ;
        B.qM qMVar = this.Qy;
        return b == qMVar ? oC(new B.qM().f(str)) : oC(qMVar.t().f(str));
    }

    @ParametersAreNonnullByDefault
    HZ I(Reader reader, String str, F f) {
        q(reader, str, f);
        Qy();
        this.V0.q();
        this.V0 = null;
        this.j = null;
        this.I = null;
        return this.q;
    }

    protected void Qy() {
        B yx;
        fd fdVar = this.j;
        B.i iVar = B.i.EOF;
        do {
            yx = fdVar.yx();
            oC(yx);
            yx.t();
        } while (yx.h != iVar);
    }

    abstract Qg V0();

    protected boolean W(String str) {
        B.x xVar = this.u;
        return this.BQ == xVar ? oC(new B.x().f(str)) : oC(xVar.t().f(str));
    }

    protected Lm h() {
        int size = this.I.size();
        if (size > 0) {
            return this.I.get(size - 1);
        }
        return null;
    }

    protected void j(String str) {
        J5 h = this.h.h();
        if (h.h()) {
            h.add(new lA(this.V0.V(), str));
        }
    }

    protected abstract boolean oC(B b);

    @ParametersAreNonnullByDefault
    protected void q(Reader reader, String str, F f) {
        R2.Qy(reader, "String input must not be null");
        R2.Qy(str, "BaseURI must not be null");
        R2.u(f);
        HZ hz = new HZ(str);
        this.q = hz;
        hz.U(f);
        this.h = f;
        this.W = f.q();
        this.V0 = new UF(reader);
        this.BQ = null;
        this.j = new fd(this.V0, f.h());
        this.I = new ArrayList<>(32);
        this.oC = str;
    }

    public boolean u(String str, QF qf) {
        B.x xVar = this.u;
        if (this.BQ == xVar) {
            return oC(new B.x().V(str, qf));
        }
        xVar.t();
        xVar.V(str, qf);
        return oC(xVar);
    }
}
